<template>
	<view class="sh-user-menu-box u-m-b-10">
		<u-cell-group class="menu-list-box">
			<u-cell-item
				class="menu-item u-flex u-row-between"
				v-for="(item, index) in list"
				:key="index"
				@tap="jump(item)"
				:icon="item.image"
				:title="item.name"
				:titleStyle="{ color: '#999999', fontSize: '26rpx' }"
				:icon-style="{ width: '36rpx', height: '36rpx' }"
			></u-cell-item>
		</u-cell-group>
	</view>
</template>

<script>
/**
 *shCell-功能列表
 * @property {Array} list - 列表信息
 */
import { mapMutations, mapActions, mapState } from 'vuex';
export default {
	components: {},
	data() {
		return {};
	},
	props: {
		list: {
			type: Array,
			default: () => {
				return [];
			}
		}
	},
	computed: {
		...mapState({
			shop: ({ shopro }) => shopro.config?.shop, // 版本信息
			userTemplate: ({ shopro }) => shopro.template?.user, //模板数据
			userInfo: ({ user }) => user.userInfo,
			userData: ({ user }) => user.userData,
			isLogin: ({ user }) => user.isLogin,
			authType: ({ user }) => user.authType
		}),
		userHeadData() {
			if (this.userTemplate?.length) {
				return this.userTemplate[0].content;
			}
		}
	},
	methods: {
		
		jump(data) {
			var that = this;
			if(data.path == "/pages/dianpu/dianpu_apply"){
				if(that.userInfo.is_zmd == 2){
					that.$u.toast('您已是专卖店身份无需重复申请');
					return;
				}
			}
			var str = data.path.split('?');
			if(str[0] == "/pages/goods/list"){
				str = str[1].split('=');
				
				if(str[1] == 276){
					if(that.userInfo.is_zmd == 1){
						
						uni.showModal({
						        title: '提示',
						        content: '您还不是专卖店，请申请专卖店！',
						        success: function(res) {
						        if (res.confirm) {
									data.path = "/pages/dianpu/dianpu_apply";
						            that.$tools.routerTo(data.path);
						        } 
						    }
						})
						return;
					}
				}
			}
			that.$tools.routerTo(data.path);
		}
	}
};
</script>

<style lang="scss" scoped></style>
